package com.adlx.dingdong.mall.dto;

import java.io.Serializable;

@SuppressWarnings("serial")
public class Response<T> implements Serializable {

	public static final int	SUCCESS	= 0;
	public static final int	ERROR	= 1;

	private int				code;
	private T				result;

	private Response(int code, T result) {
		this.code = code;
		this.result = result;
	}

	public static <T> Response<T> success(T result) {
		return new Response<T>(SUCCESS, result);
	}

	public static Response<String> error(String message) {
		return new Response<String>(ERROR, message);
	}

	public int getCode() {
		return code;
	}

	public T getResult() {
		return result;
	}

}
